# -*- python -*-
import re

class VgNo(BasicNewsRecipe):
    title          = u'VG.no'
    description    = 'Norske nyheter'
    language = 'no'
    publication_type = 'newspaper'
    oldest_article = 1
    max_articles_per_feed = 100
    keep_only_tags = [ dict(name='h1', attrs={'class':'main-title'}),
                       dict(name='div', attrs={'class':'article-main-lead'}),
                       dict(name='div', attrs={'id':'byline-source'}),
                       dict(name='div', attrs={'id':'article-body-text'}) ]

    remove_tags = [ dict(name='div', attrs={'id':'wid-article-body'}) ]

    feeds          = [(u'Forsiden', u'http://www.vg.no/rss/nyfront.php?frontId=1'),
                      (u'Nyheter innenriks', u'http://www.vg.no/rss/create.php?categories=10'),
                      (u'Nyheter utenriks', u'http://www.vg.no/rss/create.php?categories=12'),
                      (u'Sport', u'http://www.vg.no/rss/create.php?categories=20'),
                      (u'Rampelys musikk', u'http://www.vg.no/rss/create.php?categories=30'),
                      (u'Rampelys musikkanm', u'http://www.vg.no/rss/create.php?categories=45&keywords=&limit=10'),
                      (u'Rampelys film', u'http://www.vg.no/rss/create.php?categories=26'),
                      (u'Rampelys filmanm', u'http://www.vg.no/rss/create.php?categories=27'),
                      (u'Rampelys bøke', u'http://www.vg.no/rss/create.php?categories=28'),
                      (u'Interaktiv spill', u'http://www.vg.no/rss/create.php?categories=41')]

    ignore_duplicate_articles = {'title', 'url'}

    def get_cover_url(self):
       url = 'http://static.buyandread.com/thumbnail/verdensgang/verdensgang-large.jpg'
       return url
